#include <string.h>
#include <iostream>
using std::cout;
using std::endl;

//类名的命名遵循大驼峰规则
class Computer
{
public:
    //成员函数的命名遵循小驼峰规则
    void setBrand(const char * brand){
        strcpy(_brand,brand);
    }

    void setPrice(double price){
        _price = price;
    }

    void print(){
        cout << "brand:" << _brand << endl;
        cout << "price:" << _price << endl;
    }
private:
    //数据成员的命名前面加上下划线
    char _brand[20];
    double _price;
};

void test0(){
    int num;
    Computer pc;
    //不能用普通函数的调用形式
    /* setBrand("Lenovo"); */

    //成员函数需要通过对象进行调用
    pc.setBrand("Apple");
    pc.setPrice(20000);
    pc.print();

    /* pc._price = 1; */
    /* cout << pc._brand << endl; */
    /* cout << pc._price << endl; */

}

int main(void){
    test0();
    return 0;
}
